Avant de nous plonger dans le codage, voici ce dont vous aurez besoin :
Python (3.6 ou supérieur)
Bibliothèque Requests (pour effectuer des requêtes API)
Accès à l’API NH. Le point d’accès principal qui nous intéresse est :
https://statsapi.web.nhl.com/api/v1/game/[GAME_ID]/feed/live/
This post outlines a few more things you may need to know for creating and configuring your blog posts.
If you are interested in more general template features or syntax, you can visit the Introducing Lanyon or the Example Content posts.
Configurations
You should modify some of the default values in _config.yml, found in the root directory of this repo.
Things like the title, tagline, description, author information, etc. are all fair game to modify.
Be more careful when modifying the url information - things can break if done incorrectly (these are used if you are deploying via Github pages)
Creating Posts
To create a new post in the blog, add a new Markdown file to the _posts/ directory, with the name following the format YYYY-MM-DD-postname.md.
Begin the post with the following code:
---layout:posttitle:[POST TITLE]---
From there, write your content as you would a normal Markdown file.
In general, I would recommend writing one sentence per line.
This is not required, but this is far easier to work with than having a single giant line of multiple sentences for a single paragraph.
Interactive plots
Here’s how you could embed interactive figures that have been exported as HTML files.
Note that we will be using plotly for this demo, but anything that allows you to HTML should work.
All that’s required is for you to export your figure into HTML format, and make sure that the file exists in the _includes directory in this repository’s root directory.
To embed it into any page, simply insert the following code anywhere into your page.
{% include [FIGURE_NAME].html %}
For example, the following code can be used to generate the figure underneath it.
The above figure is pretty cool, but you can also embed heavier/more complex figures.
For brevity, the following figure is generated from the included plotly_html.ipynb notebook file in the repo’s root directory.
Lanyon is an unassuming Jekyll theme that places content first by tucking away navigation in a hidden drawer. It’s based on Poole, the Jekyll butler.
Built on Poole
Poole is the Jekyll Butler, serving as an upstanding and effective foundation for Jekyll themes by @mdo. Poole, and every theme built on it (like Lanyon here) includes the following:
Lanyon is by preference a forward-thinking project. In addition to the latest versions of Chrome, Safari (mobile and desktop), and Firefox, it is only compatible with Internet Explorer 9 and above.
Download
Lanyon is developed on and hosted with GitHub. Head to the GitHub repository for downloads, bug reports, and features requests.
Howdy! This is an example blog post that shows several types of HTML content supported in this theme.
Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Aenean eu leo quam. Pellentesque ornare sem lacinia quam venenatis vestibulum. Sed posuere consectetur est at lobortis. Cras mattis consectetur purus sit amet fermentum.
Curabitur blandit tempus porttitor. Nullam quis risus eget urna mollis ornare vel eu leo. Nullam id dolor id nibh ultricies vehicula ut id elit.
Etiam porta sem malesuada magna mollis euismod. Cras mattis consectetur purus sit amet fermentum. Aenean lacinia bibendum nulla sed consectetur.
Inline HTML elements
HTML defines a long list of available inline tags, a complete list of which can be found on the Mozilla Developer Network.
To bold text, use <strong>.
To italicize text, use <em>.
Abbreviations, like HTML should use <abbr>, with an optional title attribute for the full phrase.
Citations, like — Mark otto, should use <cite>.
Deleted text should use <del> and inserted text should use <ins>.
Superscript text uses <sup> and subscript text uses <sub>.
Most of these elements are styled by browsers with few modifications on our part.
Heading
Vivamus sagittis lacus vel augue rutrum faucibus dolor auctor. Duis mollis, est non commodo luctus, nisi erat porttitor ligula, eget lacinia odio sem nec elit. Morbi leo risus, porta ac consectetur ac, vestibulum at eros.
Code
Cum sociis natoque penatibus et magnis dis code element montes, nascetur ridiculus mus.
// Example can be run directly in your JavaScript console// Create a function that takes two arguments and returns the sum of those argumentsvaradder=newFunction("a","b","return a + b");// Call the functionadder(2,6);// > 8
Aenean lacinia bibendum nulla sed consectetur. Etiam porta sem malesuada magna mollis euismod. Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa.
Lists
Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Aenean lacinia bibendum nulla sed consectetur. Etiam porta sem malesuada magna mollis euismod. Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus.
Praesent commodo cursus magna, vel scelerisque nisl consectetur et.
Donec id elit non mi porta gravida at eget metus.
Nulla vitae elit libero, a pharetra augue.
Donec ullamcorper nulla non metus auctor fringilla. Nulla vitae elit libero, a pharetra augue.
Vestibulum id ligula porta felis euismod semper.
Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus.
Maecenas sed diam eget risus varius blandit sit amet non magna.
Cras mattis consectetur purus sit amet fermentum. Sed posuere consectetur est at lobortis.
HyperText Markup Language (HTML)
The language used to describe and define the content of a Web page
Cascading Style Sheets (CSS)
Used to describe the appearance of Web content
JavaScript (JS)
The programming language used to build advanced Web sites and applications
Integer posuere erat a ante venenatis dapibus posuere velit aliquet. Morbi leo risus, porta ac consectetur ac, vestibulum at eros. Nullam quis risus eget urna mollis ornare vel eu leo.
Tables
Aenean lacinia bibendum nulla sed consectetur. Lorem ipsum dolor sit amet, consectetur adipiscing elit.
Name
Upvotes
Downvotes
Totals
21
23
Alice
10
11
Bob
4
3
Charlie
7
9
Nullam id dolor id nibh ultricies vehicula ut id elit. Sed posuere consectetur est at lobortis. Nullam quis risus eget urna mollis ornare vel eu leo.
Jekyll is a static site generator, an open-source tool for creating simple yet powerful websites of all shapes and sizes. From the project’s readme:
Jekyll is a simple, blog aware, static site generator. It takes a template directory […] and spits out a complete, static website suitable for serving with Apache or your favorite web server. This is also the engine behind GitHub Pages, which you can use to host your project’s page or blog right here from GitHub.
It’s an immensely useful tool and one we encourage you to use here with Lanyon.